// ----------------------------------
// RSDK Project: Sonic CD scrapped rounds 
// Script Description: R4.5 Mine Object 
// Script Author: Twanvanb1
// ----------------------------------

// Yes...
// This was ported from 3KG.

// ========================
// Aliases
// ========================

#alias Object.Value0	:	Object.Timer

// Priority
#alias 0	:	PRIORITY_BOUNDS
#alias 1	:	PRIORITY_ACTIVE

// ========================
// Events
// ========================

sub ObjectPlayerInteraction
	if object.timer <= 0
		PlayerObjectCollision(C_TOUCH, -12, -2, 12, 4) //Detect
		if checkResult == true
			object.priority = PRIORITY_ACTIVE
			object.timer = 30
		end if
	else
		object.frame ^= 1
		object.timer--
		if object.timer != 0
		else
			PlayerObjectCollision(C_TOUCH, -12, -2, 12, 4) //Detect
			if checkResult == true
				callFunction(Player_Hit)
			end if
			CreateTempObject(TypeName[Smoke Puff], 0, object.xpos, object.ypos)
			object[tempObjectPos].drawOrder = 4
			PlaySfx(SfxName[Destroy], false)

			object.type = typeName[Blank Object]
		end if
	end if
end sub

sub ObjectDraw
	DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
end sub


sub ObjectStartup
	LoadSpriteSheet("R4.5/Objects.gif")
	SpriteFrame(-16, -8, 32, 16, 125, 18)
	SpriteFrame(-16, -8, 32, 16, 125, 1)
end sub

// ========================
// Editor Subs
// ========================

sub RSDKDraw
	DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
end sub


sub RSDKLoad
	LoadSpriteSheet("R4.5/Objects.gif")
	SpriteFrame(-16, -8, 32, 16, 125, 18)

	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end sub
